package com.xinruke.hostels.dailymanage.controller;

import com.xinruke.hostels.common.controller.BaseController;
import com.xinruke.hostels.common.vo.ResultVO;
import com.xinruke.hostels.common.vo.query.RowsDataVO;
import com.xinruke.hostels.dailymanage.interfaces.dto.roomclean.*;
import com.xinruke.hostels.dailymanage.service.RoomCleanRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@RestController
@RequestMapping("/room/clean/record/")
@Api(tags = "房间打扫记录")
@Slf4j
public class RoomCleanRecordController extends BaseController {

    @Autowired
    private RoomCleanRecordService roomCleanRecordService;

    @PostMapping(value = "/add")
    @ApiOperation("添加")
    public ResultVO<Integer> add(@RequestBody @Valid RoomCleanRecordAddDTO params){
        return roomCleanRecordService.add(params);
    }

    @PostMapping(value = "/modify")
    @ApiOperation("修改")
    public ResultVO<Integer> modify(@RequestBody @Valid RoomCleanRecordModifyDTO params){
        return roomCleanRecordService.modify(params);
    }

    @PostMapping(value = "/list")
    @ApiOperation(value = "查询房间打扫记录列表")
    public ResultVO<RowsDataVO<RoomCleanRecordQueryResultDTO>> list(@Valid @RequestBody RoomCleanRecordQueryListDTO params) {
        return roomCleanRecordService.list(params);
    }

    @PostMapping(value = "/detail")
    @ApiOperation(value = "查询房间打扫记录详情")
    public ResultVO<RoomCleanRecordQueryResultDTO> detail(@Valid @RequestBody RoomCleanRecordQueryDetailDTO params){
        return roomCleanRecordService.detail(params);
    }
}
